* This do-file assembles outcomes related to food consumption

tempfile pulse_food

forvalues y = 1/3 {
	* Food preparer consumption not asked in Year 1
	if `y'==1 local fem ""
	else if `y'>1 local fem "day_protein_resp_win5"

	use hhid total_week_pulses_win5 day_protein_ame_win5 `fem' ///
		week_grams_pigeon_pea_win5 week_grams_lentil_win5 week_grams_green_pea_win5 ///
		week_grams_green_gram_win5 week_grams_fava_bean_win5 ///
		using "${k`y'}/Food/consumption.dta", clear
		
	rename total_week_pulses_win5  	eat_week_pulse_win5
	rename day_protein_ame_win5    	eat_day_prot_win5
	if `y'>1 rename day_protein_resp_win5   	eat_day_pfem_win5
	rename week_grams_pigeon_pea_win5	eat_week_pp_win5
	rename week_grams_lentil_win5		eat_week_ll_win5
	rename week_grams_green_pea_win5	eat_week_gp_win5
	rename week_grams_green_gram_win5	eat_week_gg_win5
	rename week_grams_fava_bean_win5	eat_week_fv_win5
	
	gen byte year = `y'
	
	if `y'>1 append using `pulse_food'
save `pulse_food', replace	
}	

* Convert to per capita measures
merge m:1 hhid using "$out_data/survey_roster.dta", keepusing(hh_size) assert(match) nogen
foreach var of varlist eat_day_prot_* eat_week* {
	gen `var'_pc = `var'/hh_size
}
drop hh_size

order hhid year eat_day_* eat_week_*
save "$out_data/outcome_consumption.dta", replace
